/*
 * image.h
 *
 *  Created on: Mar 21, 2010
 *      Author: nkuyu
 */

#ifndef IMAGE_H_
#define IMAGE_H_

typedef unsigned int rgb_t;

typedef struct {
	int width;
	int height;

	rgb_t **data;
} image_t;


inline unsigned char rgb_red(rgb_t rgb)
{
	return ((rgb >> 16) & 0xff);
}

inline unsigned char rgb_green(rgb_t rgb)
{
	return ((rgb >> 8) & 0xff);
}

inline unsigned char rgb_blue(rgb_t rgb)
{
	return (rgb & 0xff);
}

inline unsigned char rgb_alpha(rgb_t rgb)
{
	return ((rgb >> 24) & 0xff);
}

inline rgb_t rgb(int r, int g, int b)
{
	return (0xff << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff);
}

inline rgb_t rgba(int r, int g, int b, int a)
{
	return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b
			& 0xff);
}

const rgb_t COLOR_BLACK = rgb(0,0,0);

#endif /* IMAGE_H_ */
